﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ShipsLog
{
    public partial class GetCode : Form
    {
        public GetCode()
        {
            InitializeComponent();
        }

        private void GetCode_Load(object sender, EventArgs e)
        {
            string email = ConfigurationManager.AppSettings["email"];
            this.label1.Text = email;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            config.AppSettings.Settings["code"].Value = this.textBox2.Text;
            config.Save(ConfigurationSaveMode.Full);
            ConfigurationManager.RefreshSection(config.AppSettings.SectionInformation.Name);
        }
    }
}
